const Koa = require('koa');
const app = new Koa();
const c = require('./config');
c.timeZoneSetting()

// const logger = require('koa-logger')
// app.use(logger());

// 连接mongodb
const mongo = require("./mongodb/mongoose");
mongo.mgsConect(c)

// 解析postdata
const koaBody = require('koa-body')
app.use(koaBody({
	multipart: true,
	jsonLimit: '5mb'
}))

// 装载路由
const router = require('./app/router/router')
router.load(app)

// 启动监听端口
app.listen(c.httpConfig.port, () => {
	console.log('KOA-API服务启用成功，端口: ' + c.httpConfig.port)
});